//
//  SyneminCoreDataManager.h
//  CoreDataTest
//
//  Created by 韩震明 on 15/11/20.
//  Copyright © 2015年 韩震明. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#warning Propose Model Name here (once)
#define MODEL_NAME @"Model"

#warning Propose EntityDescriptor_name here (once)
#define ENTITY_NAME @"Message"
@class Message;

@interface SyneminCoreDataManager : NSObject

+ (SyneminCoreDataManager *)defaults;

@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;

- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;

#pragma mark - Core Data Tool Method

- (void)addFrom:(NSString *)from to:(NSString *)to message:(NSString *)message;

- (NSArray *)selectFormatString:(NSString *)selectPredicate arguments:(NSString *)arguments;

- (void)updateFromSelectFormatString:(NSString *)selectPredicate arguments:(NSString *)arguments;

- (void)deleteFromSelectFormatString:(NSString *)selectPredicate arguments:(NSString *)arguments;

- (NSArray *)selectAll;

@end
